{% extends "base.html" %}
{% block header %}编辑普通用户{% endblock %}
{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card shadow-sm rounded p-4">
            <h4 class="mb-3">编辑普通用户</h4>
            <form method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="username" class="form-label">用户名</label>
                    <input type="text" class="form-control" id="username" name="username" value="{{ user.username }}" required>
                </div>
                <div class="mb-3">
                    <label for="realname" class="form-label">姓名</label>
                    <input type="text" class="form-control" id="realname" name="realname" value="{% if profile %}{{ profile.realname }}{% endif %}" required>
                </div>
                <div class="mb-3">
                    <label for="email" class="form-label">邮箱</label>
                    <input type="email" class="form-control" id="email" name="email" value="{{ user.email }}" required>
                </div>
                <div class="mb-3">
                    <label for="is_active" class="form-label">是否启用</label>
                    <select class="form-select" id="is_active" name="is_active">
                        <option value="True" {% if user.is_active %}selected{% endif %}>启用</option>
                        <option value="False" {% if not user.is_active %}selected{% endif %}>禁用</option>
                    </select>
                </div>
                <button type="submit" class="btn btn-success">保存</button>
                <a href="/normal_user/" class="btn btn-secondary ms-2">取消</a>
            </form>
        </div>
    </div>
</div>
{% endblock %}
